<!-- brandadd 页面内容 -->
<section class="brandadd" ng-controller="brandaddCtrl">
  <ol class="breadcrumb">
    <li ui-sref="mine.list({ ctrl: 'functions' })"><a>更多功能</a></li>
    <li ng-click="goBack();"><a>品牌设置</a></li>
    <li><a>新增部门</a></li>
  </ol>
  <div class="panel panel-default">
    <div class="panel-body" ng-if='step == 1'>
      <ul class="prew_depart">
        <li ng-repeat="(key, cd) in create_departments track by key">
          {{cd.name}}
          <span class="del" ng-click="deletedepart(key);"></span>
        </li>
      </ul>
      <form name='adddepartForm' class="form-inline" novalidate>
        <div style="margin-bottom: 10px;">部门</div>
        <div class="form-group">
          <input type="text" class="form-control" ng-model="depart.name" id="depart_name" placeholder="请输入...">
        </div>
        <div class="form-group">
          <button type='submit' class="btn yf-btn" ng-click="adddepart(depart);">添加</button>
        </div>
      </form>
      <div class="form-group" style="margin-top: 10px;">
        <button type='button' class="btn yf-btn" style="border-radius: 3px;" ng-click="createDepartment();">确认添加</button>
      </div>
    </div>

    <div class="panel-body" ng-if='step == 2'>
      <form name="createRoleDepartForm" novalidate>
        <div class="form-group">
          <label for="department_id">选择部门</label>
          <select ng-model="create_role_depart.department_id" id='department_id' class="form-control" ng-options="depart.id as depart.name for depart in departments">
            <option value="" selected="true" disabled="true">选择部门</option>
          </select>
        </div>
        <div class="form-group">
          <label for="dname">角色名称</label>
          <input type="text" ng-model="create_role_depart.name" id='dname' class="form-control" placeholder="请输入...">
        </div>
        <div class="form-group">
          <label for="exampleInputFile">角色权限</label>
        </div>
        <div class="radio">
          <label ng-repeat="(key, role) in roles track by key" style="margin-left: 10px;">
            <input type="radio" ng-model="create_role_depart.rules" ng-value="role.rules"> {{role.name}}
          </label>
        </div>
        <div class="form-group">
          <button type="submit" class="yf-btn" ng-click="createRoles();" ng-bind="create_role_depart.id ? '确认修改': '确认添加'"></button>
        </div>
      </form>
    </div>
  </div>
</section>